﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace Cn.Cellula.Client {
    public class MailBiz {
		public static void SendMail(string rSubject,string rContent,string rToEmail,string rReplyTo)
		{
			MailMessage mm = new MailMessage(SiteConfig.Smtp.SmtpFrom,rToEmail);
			mm.Body = rContent;
            mm.IsBodyHtml = true;
            if (String.IsNullOrEmpty(rReplyTo))
                rReplyTo = SiteConfig.Smtp.SmtpFrom;
            mm.ReplyTo = new MailAddress(rReplyTo);
			mm.Subject = rSubject;
            mm.Priority = MailPriority.Normal;

            SmtpClient sc = new SmtpClient(SiteConfig.Smtp.SmtpServer, SiteConfig.Smtp.SmtpPort);
            sc.Credentials =  new NetworkCredential(SiteConfig.Smtp.SmtpUser, SiteConfig.Smtp.SmtpPwd);//发件人的用户名和密码
            sc.EnableSsl = SiteConfig.Smtp.SmtpSSL;
            sc.Send(mm);
        }
    }
}
